import { sequelize } from '../../db';
import { DataTypes, Model } from 'sequelize';

class ProcureList extends Model { }
ProcureList.init({
    from: DataTypes.INTEGER,
    UserId: DataTypes.INTEGER,
    StoreItemId: DataTypes.INTEGER,
    TemplateId: DataTypes.INTEGER,
    phone: DataTypes.STRING,
    state: DataTypes.INTEGER,
    ProcureOrderId: DataTypes.INTEGER,
    state_name: {
        type: DataTypes.VIRTUAL,
        get() {
            const dis = ['', '未确认', '待支付', '已支付', '已发货']
            return dis[this.dataValues.state]
        },
        set(value) {
            throw new Error('不要尝试设置 `create` 的值!');
        }
    }
}, {
    sequelize
});

export default ProcureList